const { Router } = require('express')
const express =  require('express')
// //创建路由对象
const router = express.Router()

// //导入用户路由处理函数模块
const userHandler = require('../router_handle/user')

// //导入验证数据的中间键
const expressJoi = require('@escook/express-joi')
// // 导入需要验证的规则
const { reg_login_schema } = require('../schema/user')  


// //注册新用户
// router.post('/reguser',userHandler.regUser)
router.post('/reguser',expressJoi(reg_login_schema),userHandler.regUser)

// //登录 
router.post('/login',userHandler.login)

//获取更新月余额
router.post('/upmoney',userHandler.select_updata)

//获取本月余额
router.post('/money',userHandler.select_getdate)
//获取插入事件
router.post('/insertUser',userHandler.select_goods)

// 获取本月消费
router.post('/monthSpend',userHandler.select_monthSpend)
//获取当天消费
router.post('/todaySpend',userHandler.select_todaySpend)

//查看明细
router.post('/mingxi',userHandler.select_mingxi)

//查看报表
router.post('/baobiao',userHandler.select_baobiao)


//测试
router.get('/ce',userHandler.ce)
router.post('/ce',userHandler.ce)

//测试
router.get('/cedata',userHandler.cedata)
router.post('/cedata',userHandler.cedata)



// //将路由对象共享出去
module.exports = router